package com.xujie.property_warranty_system.enums;

import lombok.Getter;

/**
 * 维护结果枚举
 */
@Getter
public enum MaintenanceResult {
    
    NORMAL(1, "正常"),
    FOLLOW_UP(2, "需要跟进"),
    SCRAP(3, "建议报废");
    
    private final Integer code;
    private final String description;
    
    MaintenanceResult(Integer code, String description) {
        this.code = code;
        this.description = description;
    }
    
    /**
     * 根据结果码获取枚举
     */
    public static MaintenanceResult fromCode(Integer code) {
        for (MaintenanceResult result : MaintenanceResult.values()) {
            if (result.getCode().equals(code)) {
                return result;
            }
        }
        return NORMAL; // 默认返回正常
    }
}
